print("Введите скобочную последовательность: ")
s = input()
s1 = ''

a1 = s.count("(")
a2 = s.count(")")
b1 = s.count("[")
b2 = s.count("]")
c1 = s.count("{")
c2 = s.count("}")
d1 = s.count("<")
d2 = s.count(">")

for char in s:
    if char == '(' :
        s1 += char

    if char == ')':
        if len(s1)>0:
            if s1[len(s1) -1] == '(':
                s1 = s1[:-1]

    if char == '{':
        s1 += char

    if char == '}':
        if len(s1)>0:
            if s1[len(s1) -1] == '{':
                s1 = s1[:-1]

    if char == '[':
        s1 += char

    if char == ']':
        if len(s1)>0:
            if s1[len(s1) -1] == '[':
                s1 = s1[:-1]

    if char == '<':
        s1 += char

    if char == '>':
        if len(s1)>0:
            if s1[len(s1) -1] == '<':
                s1 = s1[:-1]
    print(s1)

if len(s1)==0 and a1==a2 and b1==b2 and c1==c2 and d1==d2:
    print("Верная")
else:
    print("Неверная")